package com.itheima.subway.info.manage.domain;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class SubwayMassage {
    //用来将subways.txt中的数据读取到list集合中
    public static ArrayList<Subways> readSubways() {
        BufferedReader br = null;
        String[] split;
        ArrayList<Subways> list = new ArrayList<>();
        try {
            br = new BufferedReader(new FileReader("study_test01\\managers.txt"));
            String line;
            while ((line = br.readLine()) != null) {
//                System.out.println(line);
                split = line.split(",");
                Subways s = new Subways(split[0], split[1], split[2]);
                list.add(s);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return list;
    }
}
